|
- import fetch from 'node-fetch'
-
- export default eventHandler(async (req) => {
- const id = req.context.params?.id || ''
- const url = `https://api.themoviedb.org/3/movie/${id}?language=fr-FR`
- const url_credits = `https://api.themoviedb.org/3/movie/${id}/credits?language=fr-FR`
- const config = useRuntimeConfig(req)
-
- const response = await fetch(url, {
- method: 'get',
- headers: { 'Content-Type': 'application/json', 'Authorization': config.API_BEARER }
- })
- const response_credits = await fetch(url_credits, {
- method: 'get',
- headers: { 'Content-Type': 'application/json', 'Authorization': config.API_BEARER }
- })
-
- let details = await response.json()
- details.credits = await response_credits.json()
- return details
- })
|